﻿#pragma once

#include <QWidget>
#include "../../sdl/render/IVideoRenderView.h"
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QPaintEvent>
#include <QDragMoveEvent>

class YDecoderTask;
class YDemuxerTask;

class YCameraWidget : public QWidget
{
	Q_OBJECT

public:
	YCameraWidget(QWidget *parent = nullptr);

    //拖拽进入
    void dragEnterEvent(QDragEnterEvent* e) override;

    //拖拽移动
    void dragMoveEvent(QDragMoveEvent* e) override;

    //拖拽松开
    void dropEvent(QDropEvent* e) override;

    //渲染
    void paintEvent(QPaintEvent* p);

    //打开rtsp 开始解封装 解码
    bool Open(const char* url);


    //渲染视频
    void Draw();

    //停止
    void Stop();

	~YCameraWidget();

private:
    YDecoderTask* decode_ = nullptr;
    YDemuxerTask* demux_ = nullptr;
    IVideoRenderView* view_ = nullptr;
};
